package lingou.homework.postbar.domain;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lingou.homework.postbar.domain.enums.UserTypeEnum;

import java.sql.Timestamp;

//@TableName("user")
public class User {
  @TableId(type = IdType.AUTO)
  private long userId;
  private String userName;
  @JsonIgnore
  private String password;
  private long userType;
  private String email;
  private long status;
  private Timestamp time;

  public long getUserId() {
    return userId;
  }

  public void setUserId(long userId) {
    this.userId = userId;
  }


  public String getUserName() {
    return userName;
  }

  public void setUserName(String userName) {
    this.userName = userName;
  }


  public String getPassword() {
    return password;
  }

  public void setPassword(String password) {
    this.password = password;
  }


  public long getUserType() {
    return userType;
  }

  public void setUserType(long userType) {
    this.userType = userType;
  }


  public String getEmail() {
    return email;
  }

  public void setEmail(String email) {
    this.email = email;
  }


  public long getStatus() {
    return status;
  }

  public void setStatus(long status) {
    this.status = status;
  }


  public boolean isManager(){
    return this.userType == UserTypeEnum.MANAGER.getId();
  }

  public Timestamp getTime() {
    return time;
  }

  public void setTime(Timestamp time) {
    this.time = time;
  }

  @Override
  public String toString() {
    return "User{" +
            "userId=" + userId +
            ", userName='" + userName + '\'' +
            ", password='" + password + '\'' +
            ", userType=" + userType +
            ", email='" + email + '\'' +
            ", status=" + status +
            ", time=" + time +
            '}';
  }

}
